home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: MegaDisc
/
MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].zip
/
MegaDisc 45 (1996-03)(MegaDisc Digital Publishing)(AU)(Disk 1 of 2)[WB].adf
/
Programs
/
Ripple
/
Ripple0MD.e
/
Ripple0MD.e
Wrap
Text File
|
1996-02-15
|
2KB
|
85 lines
/*
* R I P P L E 0
*
* Plot a semirandom symmetrical design.
* Uses a backdrop window in a custom screen.
*
* Written by M. Stapleton of Graphic Bits © 1996
* My first E program!
*
* Feb 9 1996
*
*/
OPT OSVERSION=33
MODULE 'intuition/intuition', 'intuition/screens',
'graphics/gfxbase', 'graphics/view'
CONST MI=100
PROC main()
DEF i, j, x, y, p, mx, my, rx, ry, depth, mp, sp,
loc[3]:ARRAY, hic[3]:ARRAY, cc[3]:ARRAY,
screen, window, gbase : gfxbase
/* Get max depth */
depth := IF KickVersion(39) THEN 8 ELSE 4
/* Get normal screen size & max depth */
gbase := gfxbase
mx := gbase.normaldisplaycolumns
my := gbase.normaldisplayrows * 2
mp := Shl(1,depth) - 1 ->Max pen
/* Colour scaling factor */
sp := mx * my / mp / 2
/* Base colours for range */
loc := [255, 136, 0]:CHAR
hic := [0, 0, 187]:CHAR
/* Open a full-size Hires Interlace screen */
IF screen := OpenS(mx, my, depth, V_LACE OR V_HIRES, NIL,
[SA_QUIET,TRUE, 0])
/* Set palette */
SetColour(screen, 0, 0, 0, 0) ->Black background
FOR i := 1 TO mp
FOR j := 0 TO 2
cc[j] := (hic[j] - loc[j]) * (i-1) / (mp-1) + loc[j]
ENDFOR
SetColour(screen, i, cc[0], cc[1], cc[2])
ENDFOR
/* Open a backdrop window */
IF window := OpenW(0, 0, mx, my,
IDCMP_MOUSEBUTTONS,
WFLG_BACKDROP OR WFLG_BORDERLESS OR
WFLG_NOCAREREFRESH OR WFLG_RMBTRAP,
NIL, screen, $f, NIL)
REPEAT
FOR i := 0 TO MI
/* Semirandom, symmetrical design */
x := Rnd(mx); y := Rnd(my)
rx := mx - x; ry := my - y
/* Determine pen from radius */
p := 1 + Mod((x*x) + (y*y) / sp, mp)
/* Four way symmetry */
Plot(x, y, p)
Plot(rx, y, p)
Plot(rx, ry, p)
Plot(x, ry, p)
ENDFOR
UNTIL LeftMouse(window)
CloseW(window)
ENDIF
CloseS(screen)
ENDIF
ENDPROC